package cc.Controller;

import cc.Entity.Results;
import cc.Utils.ListToResultUtil;
import cc.Utils.PictureUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

/**
 * @Auther: ${张智杰}
 * @Date: 2018/10/11 11:53
 * @Description:
 */
@Controller
public class PictureController {
   /* *//**
     * 上传图片文件,由扫描端调用
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/img",method = RequestMethod.POST)
    public Results uploadPaperImage(MultipartFile file, HttpServletRequest request){
        try {
            List list = new ArrayList();
            list.add(PictureUtil.uploadFile(file,request));
           return ListToResultUtil.getResult(true,"00","成功",list);
        }catch (Exception e){
            e.printStackTrace();
            return ListToResultUtil.getResult(false,null,"失败",null);
        }
    }
}
